package StudyCode.summary.mycollection;

import java.util.ArrayList;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class LoopThroughElementsForArrayList {
	public static void main(String[] args) {
		ArrayList arrayList = new ArrayList();
		arrayList.add("1");
		arrayList.add("2");
		arrayList.add("3");

		System.out.println("方法一:For 循环");
		for (int i = 0; i < arrayList.size(); i++) {
			System.out.println(arrayList.get(i));
		}

		System.out.println("方法二:For each");
		for (Object o : arrayList) {
			System.out.println(o);
		}
	}
}
